﻿@model PagedList<OnlineMealOrdering.Areas.WebSiteManage.Models.AccountModel>
@{
    ViewBag.Title = "用户管理";
    Layout = "~/Areas/WebSiteManage/Views/Shared/_Layout.cshtml";
}
@{ 
    var cl = Html.DisplayColumns<OnlineMealOrdering.Areas.WebSiteManage.Models.AccountModel>();
}
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=C06d429c09fd4cd636af81d60e14a4ed"></script>
<div class="row-fluid sortable ui-sortable">
    <div class="box span12">
        <div class="box-header" data-original-title="">
            <h2><i class="icon-user"></i><span class="break"></span>用户管理</h2>
            <div class="box-icon">
                <a href="#" class="btn-setting"><i class="icon-wrench"></i></a>
                <a href="#" class="btn-minimize"><i class="icon-chevron-up"></i></a>
            </div>
        </div>
        <div class="box-content">
            <div role="grid" class="dataTables_wrapper" id="DataTables_Table_0_wrapper">
                <table class="table table-striped table-bordered bootstrap-datatable datatable dataTable" id="DataTables_Table_0">
                    <thead>
                        <tr>
                            @foreach (var item in cl.Where(a => a.Visible))
                            {
                                <th>@item.DisplayName</th>                                
                            }
                            <th>位置</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr>
                                @{
                            var dic = new Dictionary<string, Func<string, string>>();
                            dic.Add("Id", x => string.Format("<span class=\"badge\">{0}</span>", x));                                
                                }

                                @Html.DisplayForEx(item, dic)
                                <td>
                                    @Html.BootStarpStyleBtn("位置", "icon-map-marker",
                                    new { @class = "btn btn-link ", @onclick = "showLoaction(this)", @lo = item.Longitude, @la = item.Latitude })
                                </td>
                                <td>
                                    @Html.BootStarpBtnStylelink("编辑", "icon-pencil icon-white", Url.Action("UserEdit", new { id = item.Id }), new { @class = "btn btn-small btn-primary " })
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "id", ContainerTagClass = "pagination", PageIndexBoxType = PageIndexBoxType.DropDownList, })
        </div>
    </div>
    <hr />
</div>
<!--===========end:Content===========-->
<script type="text/javascript">
    function showLoaction(e) {
        var lo = $(e).attr("lo");
        var la = $(e).attr("la");        
        $(".modal-body").load('/WebSiteManage/Component/UserLocation?lo=' + lo + '&la=' + la, function () {
            $("#myModal").modal({
                backdrop: false,
                keyboard: true,
            });
        })
    }
</script>



